var RegistrationForm = Backbone.View.extend({
    model: new UserModel,
    initialize: function (options) {
        this.channel = options.channel;
        _.bindAll(this, "show", "sendRegistration", "hide");

        this.$el.find('#register').click(this.sendRegistration);
        this.channel.bind("showRegistrationForm", this.show);
        this.channel.bind("hideRegistrationForm", this.hide);
    },
    sendRegistration: function () {
        this.model.set("name", this.$el.find('#name').val());
        this.model.set("address", this.$el.find('#address').val());
        this.model.set("password", this.$el.find('#password').val());
        this.model.set("passwordConfirmation", this.$el.find('#cpassword').val())
        this.model.set("phone", this.$el.find('#phone').val())
        this.model.set("email", this.$el.find('#email').val())
        this.model.save();
         $("#myDreams").show();
        this.channel.trigger("cShowMakeMyDreamForm");
             $("#loggedIn").html($("#name").val());
        $("#loggedIn").show()
    },
    show: function () {
        this.channel.trigger("cHideWelcomeScreen");
        this.$el.show();
    },
    hide: function () {
        this.$el.hide();
    }


});